// 引入 Mock
import Mock from "mockjs";

// 定义数据类型
const data = [
  {
    username: "admin",
    password: "123",
  },
  {
    username: "zhangsan",
    password: "123456",
  },
];

Mock.mock("/api/login", "post", (option) => {
  const { username, password } = JSON.parse(option.body);

  if (!username || !password) {
    return {
      status: 1,
      msg: "参数错误",
    };
  }

  return {
    status: 0,
  };
});

export default Mock;
